<template>
  <div class="container">
    <h3>用户管理</h3>
    <el-row>
      <el-button type="primary">新增</el-button>
      <el-button type="default">查询</el-button>
    </el-row>
    <el-row>
      <el-table :data="userList" style="width: 100%">
        <el-table-column prop="name" label="姓名" width="180" />
        <el-table-column prop="username" label="用户名" width="180" />
        <el-table-column prop="introduction" label="介绍" />
      </el-table>
    </el-row>
    <el-row>
      <el-pagination
        :current-page.sync="currentPage"
        :page-size="pageSize"
        :page-sizes="[10, 20, 30, 50]"
        layout="total, prev, pager, next"
        :total="total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </el-row>
  </div>
</template>

<script>
import { getUserListByConditionAndPage } from "@/api/user";

export default {
  name: "UserMgt",
  data() {
    return {
      currentPage: 1,
      pageSize: 10,
      total: 3,
      pageSizeOptions: [10, 20, 30, 50],
      userList: [],
    };
  },
  mounted() {
    getUserListByConditionAndPage({
      offset: (this.currentPage - 1) * 10,
      limit: 10,
    }).then((res) => {
      this.total = res.data.total;
      this.userList = res.data.list;
    });
  },
  methods: {
    handleSizeChange(v) {},
    handleCurrentChange(v) {},
  },
};
</script>

<style lang="scss">
.container {
  padding: 20px;
}
</style>
